<!DOCTYPE html>
<html>
<head>
  <title>打开/dev/video0</title>
</head>
<body>
  <video id="videoElement" autoplay></video>

  <script>
    // 获取video元素
    var video = document.getElementById('videoElement');

    // 使用getUserMedia函数获取视频流
    //navigator.mediaDevices.getUserMedia({ video: { deviceId: '/dev/video1' } })
    navigator.mediaDevices.getUserMedia({ video: { deviceId: '/dev/video1' } })
      .then(function(stream) {
        // 将视频流绑定到video元素
        video.srcObject = stream;
      })
      .catch(function(error) {
        console.error('无法访问摄像头', error);
      });
  </script>
</body>
</html>

